﻿<controls:MetroWindow x:Class="QuickMail.View.Windows.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:controls1="clr-namespace:QuickMail.View.Controls"
        xmlns:tb="http://www.hardcodet.net/taskbar"
        xmlns:w="clr-namespace:QuickMail.View.Windows"
        WindowStartupLocation="CenterScreen"
        Title="QuickMail - When it is important that the inside." 
        Height="600" Width="1130" MinHeight="500" MinWidth="900"
        x:Name="QuickMailWindow">
    
    <Window.Resources>
            <ResourceDictionary Source="../../ResourceDictionary.xaml"/>
    </Window.Resources>

    <Grid>
        <tb:TaskbarIcon x:Name="QmNotifyIcon"
                    Visibility="Visible"
                    ToolTipText="QuickMail - Email messenger"
                    IconSource="../../tray.ico"
                    MenuActivation="LeftOrRightClick"
                    TrayMouseDoubleClick="QmNotifyIcon_OnTrayMouseDoubleClick">
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu Opened="ContextMenu_OnOpened">
                    <MenuItem x:Name="ShowMenuItem" Header="Show window" Click="ShowMenuItem_OnClick"/>
                    <MenuItem x:Name="HideMenuItem" Header="Hide window" Click="HideMenuItem_OnClick"/>
                    <Separator/>
                    <MenuItem Header="Exit" Click="ExitMenuItem_OnClick"/>
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>
        </tb:TaskbarIcon>
        <Border BorderThickness="2" BorderBrush="#41B1E1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="250" MinWidth="250" MaxWidth="500"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
                    <Button x:Name="ConnectSettingsButton" Height="35" Width="35" Margin="3" HorizontalAlignment="Left"
                         Click="ConnectSettings_OnClick">
                        <Image Source="../../Resources/connected-32.png"></Image>
                    </Button>

                    <Button x:Name="CommonSettingsButton" Height="35" Width="35" Margin="3" HorizontalAlignment="Left"
                         Click="CommonSettings_OnClick">
                        <Image Source="../../Resources/settings2-32.png"></Image>
                    </Button>

                    <Button x:Name="AboutButton" Height="35" Width="35" Margin="3" HorizontalAlignment="Left"
                         Click="About_OnClick">
                        <Image Source="../../Resources/info-32.png"></Image>
                    </Button>
                </StackPanel>

                <StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal"
                        HorizontalAlignment="Right" VerticalAlignment="Center">
                    <TextBox x:Name="SearchTextBox" Width="250" Margin="10, 0" VerticalAlignment="Center" TextChanged="SearchTextBox_OnTextChanged"/>
                    <Button Width="35" Height="35" Margin="3" Click="Search_OnClick">
                        <Image Source="../../Resources/search-32.png"/>
                    </Button>
                </StackPanel>



                <GroupBox Grid.Row="2" Grid.Column="0" x:Name="RulesGroupBox" Header="Rules of mail processing" Margin="0">
                    <controls1:RulesControl Margin= "-5, -5" x:Name="MainRulesControl"/>
                </GroupBox>

                <GridSplitter Grid.Row="2" Grid.Column="0" Width="1" Background="#41B1E1"/>

                <GroupBox Grid.Row="2" Grid.Column="1" x:Name="ListOfLettersGroupBox"
                                                           Header="List of letters" Margin="0">
                    <ContentPresenter x:Name="DataPresenter" Margin="-5"/>
                </GroupBox>

                <Border Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"  BorderThickness="1" BorderBrush="#41B1E1">
                    <StatusBar Height="30">
                        <StackPanel Orientation="Horizontal">
                            <Image x:Name="StatusImage" Source="../../Resources/disconnected-32.png" Margin="5, 1"/>
                            <TextBlock x:Name="StatusTextBlock" Text="Please wait...  Checking connection..." VerticalAlignment="Center" FontSize="14"/>
                        </StackPanel>
                    </StatusBar>
                </Border>
            </Grid>
        </Border>
    </Grid>
</controls:MetroWindow>